package com.okq.service.Impl;

import com.okq.dao.ApprovalDao;
import com.okq.entity.Approval;
import com.okq.service.IApprovalService;
import com.okq.util.page.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 描述 : 审批接口实现类
 * 作者 : zdl
 * 日期 : 2017/6/30 10:18
 */
@Transactional
@Service
public class ApprovalServiceImpl implements IApprovalService {

    @Autowired
    private ApprovalDao approvalDao;

    @Override
    public void saveApproval(Approval approval) {
        approvalDao.saveApproval(approval);
    }

    @Override
    public void deleteApproval(Approval approval) {
        approvalDao.deleteApproval(approval);
    }

    @Override
    public void updateApproval(Approval approval) {
        approvalDao.updateApproval(approval);
    }

    @Override
    public Approval getApprovalById(String id) {
        return approvalDao.getApprovalById(id);
    }

    @Override
    public Page<Approval> pageByApproval(Page<Approval> page, Approval approval) {
        return approvalDao.pageByApproval(page, approval);
    }

    @Override
    public List<Approval> listApprovalByUserId(String userId) {
        return approvalDao.listApprovalByUserId(userId);
    }

    @Override
    public Approval getApprovalByTypeAndId(Integer type, String relevantId) {
        return approvalDao.getApprovalByTypeAndId(type, relevantId);
    }
}
